﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;

namespace FFPCruise
{
    public class Cruise
    {
        public delegate void PanRightCallback(int speed);
        public PanRightCallback PanRight = null;
        public delegate void PanStopCallback();
        public PanStopCallback PanStop = null;
        public delegate void PanTileGoAngleCallback(int hAngle, int vAngle);
        public PanTileGoAngleCallback PanTileGoAngle;
        public Cruise()
        {
        }

        public void CruiseTime()
        {
            if (PanRight != null && PanStop != null)
            {
                PanRight(4);
                Thread.Sleep(2000);
                PanStop();
            }
        }

        int hAngle = 0;
        int vAngle = 15;
        public void CruiseAngle()
        {
            if (PanTileGoAngle != null)
            {
                PanTileGoAngle(hAngle, vAngle);
                hAngle += 30;
                if (hAngle >= 360)
                {
                    hAngle = 0;
                    vAngle -= 15;

                    if (vAngle == -15)
                        vAngle = 15;
                }
                Thread.Sleep(2000);
            }
        }
    }
}
